package com.neihe.common.base;

import lombok.Getter;

@Getter
public class ResultVO<T> {

    /**
     * 状态码，比如1000代表响应成功
     */
    private final int code;

    /**
     * 响应信息，用来说明响应情况
     */
    private final String msg;

    /**
     * 响应的具体数据
     */
    private final T data;

    public ResultVO(T data) {
        this(ResultCode.SUCCESS, data);
    }

    public ResultVO(ResultCode resultCode, T data) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMessage();
        this.data = data;
    }

    public ResultVO(int code, String msg) {
        this.code = code;
        this.msg = msg;
        this.data = null;
    }

}
